<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common-app/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>申请书编辑</title>
<script type="text/javascript" src="${res}/js/jquery/jquery.form.js"></script>
<script type="text/javascript"
	src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript"
	src="${res}/js/validate/irisvalidator.js"></script>
<script type="text/javascript"
	src="${res}/js/keyword/keywordtips.js"></script>	
<script type="text/javascript"
	src="${res_app}/js/app/proposal/irisPrpPrepare.js"></script>

<style>
	textarea{overflow:auto;}
</style>

<script type="text/javascript">
$(function(){
	queryflex();
});
/**
 * 申请书提交方法
 */


var ctxpath = "${ctx}";
var prcWin = new progressWin("${res}");//初始化遮罩层
/**
 * 页面初始化方法 所有的都定义在里面
 */
$(document).ready (function() {
	$("#wbox1").click(function() {
		check("check");
	});
	
	$("#wbox2").click(function() {
		
		check("check");
		
	});
	
	initControl();
	
	$("table").not("[id='basic_tb2']").each(function(){
		$(this).find("tr:even").removeClass("li_1").removeClass("li_2").addClass("li_1");
		$(this).find("tr:odd").removeClass("li_1").removeClass("li_2").addClass("li_2");
	});
	
	$("table").addClass("table01");
	$("#checkbox_table_").removeClass("table01");
	$("#feaReport_upload").removeClass("table01");
    $('div').find("[id^='checkbox_dyn_']").find("tr").removeClass("li_1").removeClass("li_2");
    $('div').find("[id^='checkbox_dyn_']").find("td").css("border",'0px solid');
	
	window.setInterval("checkPdfStatus()", "10000");//检验申请书的pdf
});

$(document).ready(function() {
	fileInit("feaReport_upload","DOC,DOCX,PDF,WPS");
	fileInit("prpContent_upload","PDF,DOC,DOCX,WPS",null,"{'PDF':'20480','DOCX':'20480','DOC':'20480','WPS':'20480'}");
	
	//fileInitAttach("attachAdd", "JPG,PDF", null, 20, "{'JPG':'3072','PDF':'3072'}");
	$("#prpContent_upload").find(".file").hide();//隐藏文本框
});


$(document).ready(function() {
	$("#org").attr("disabled","true");
	initDepartForComplete("org");
	 initControl();
});

/**
 * 申报日期默认为当前日期
 */
$(document).ready(function() {


	var nowDate = '${sercverSysDate1}';
    if($("#submit_date").val()==""){
	   $("#submit_date").val(nowDate);
    }

});

/**
 * 填写检查
 */
function check(type){
	setTotalAmt();
	 validate($("#fragment-tab1"),"单位基本情况");
	validate($("#fragment-tab2"),"项目基本情况");
	validate($("#fragment-tab3"),"经费说明");
	checkRequestMoney();
	validate($("#overall_objective_tab"),"绩效目标");
	validate($("#benefit_index_tab"),"绩效目标");
	validate($("#fragment-tab5"),"项目绩效指标");
	zhibiao();
	validate($("#fragment-tab6"),"附件清单");  
	/* $("#fundInfo_before tr").each(function(){
		var str1=$(this).children('td').eq(1).children('input').val();
		var str2=$(this).children('td').eq(2).children('input').val();
		if (parseFloat(str1) < parseFloat(str2)) {
			var msg = "经费情况-->资金支出概算" + $(this).children('td').eq(1).children('input').attr("label") + "必须大于等于"
						+$(this).children('td').eq(2).children('input').attr("label");
			irisValaddMsg(msg);
		}
	}); */
		/*  checkNull(); */
	
	  //checkSize();  
	prp_attach(); 
	if(!valResult()){
		irisValShowMsg($("#wbox1"));
		return false;
	}
	if(type=="check"){
		showBox($("#wbox1"), "300px", "200px", "检查通过","1:所有检查全部合格");
	}
	return true;
}

//检查项目绩效指标值是否大于0
function zhibiao(){
	for(var i=1 ; i<=15;i++){
		var performance_2018 = $("#performance"+i+"_1").val();
		var performance_2019 = $("#performance"+i+"_2").val();

		
		if(performance_2018 !='' && performance_2018<=0){
			var label_2018 = $("#performance"+i+"_1").attr("label");
			var msg ="项目绩效指标-->" + label_2018+"必须大于0";
			irisValaddMsg(msg);
		}
		
		if(performance_2019 !='' && performance_2019<=0){
			var label_2019 = $("#performance"+i+"_2").attr("label");
			var msg="项目绩效指标-->"+label_2019+"必须大于0";
			irisValaddMsg(msg);
		}
	}
}
//检查项目申请金额是否等于申请经费
function checkRequestMoney(){
	var request_amt =$("#prequest_amt").val();
	var total_amt = $("#total_amt").val();
	if(request_amt !='' && total_amt !='' && request_amt != total_amt){
		var msg="项目基本情况 -->项目申请金额不等于经费说明-->申请经费 ";
		irisValaddMsg(msg);
	}
}

function setTotalAmt(){
	/* $('#total_amt').val($("#input_total").val()); */
	$('#source_apply').val($("#request_money").val());
	$('#request_amt').val($("#request_amount").val());
}

</script>
<style>
	textarea{overflow:   auto;}
</style>
</head>
<body>

	<c:set var="xmlstr" value="${xmlData}" scope="request"/>
	<x:parse xml="${xmlstr}" var="xmlData"  scope="request" />
	<input type="hidden" id="childDiv" class="thickbox"/>
	<input type="hidden" id="filePath" value="${ctx}/file/ajax-filedownload?fileCode=" />
	<input type="hidden" id="menuId" value="${param.menuId}" />
	<input type="hidden" id="sysDate" value="${sercverSysDate}" />
	<div id="showMessage"></div>
	<div id="content">
		
		<cpt:helpTips key="prpedit" id="prpEditTips"></cpt:helpTips>
		<div class="clear_h15"></div>
		<div class="word_box" id="mainDiv">
		    
		   <!-- 公用的配置界面 ：保存、提交等button-->
		    <jsp:include page="./prpeditmain_public_first.jsp"><jsp:param value="${xmlstr}" name="xmlstr" /></jsp:include>
		    
			<div class="bar_b">
				<input type="hidden" id="pdfStatus" value="${pdfStatus}" />
				<span class="right">版本号：<span name="proposal/prp_version" id="prp_version"><x:out select="$xmlData/data/proposal/prp_version" /></span></span>
			</div>
			<form method="post" id="mainForm">
				<input type="hidden" value="${grantCode}" id="grantCode"
					name="grantCode"> 
				<input type="hidden" value="${posCode}" id="posCode" name="posCode"> 
				<input type="hidden" value="<iris:des3 code="${posCode}"></iris:des3>" id="posCodeDes" name="posCodeDes">
				<input type="hidden" value="<iris:des3 code="${fbl.pdfCode}"></iris:des3>" id="pdfCodeDes" name="pdfCodeDes">  
				<input type="hidden" value="${xmlData}" id="xmlData" name="xmlData">
				<input type="hidden" value="${fbl.pdfCode}" id="pdfCode" name="pdfCode"> 
				<input type="hidden" value="${flag_shizhi}" id="flag_shizhi" name="proposal/flag_shizhi"> 
			</form>
				<div class="word_title">
					<c:set var="statYear">${statYear}</c:set>
					<c:if test="${empty statYear}">
						<c:set var="statYear"><x:out select="$xmlData/data/proposal/stat_year" /></c:set>
					</c:if>
					<input type="hidden" name="proposal/stat_year" value="${statYear}">
					<span name="proposal/grant_name" ><x:out select="$xmlData/data/proposal/sub_grant_name" /></span>-项目申报书 (<span name="proposal/stat_year">${statYear}</span>年)<%-- <br/><span name="proposal/sub_grant_name" >(<x:out select="$xmlData/data/proposal/sub_grant_name" />)</span> --%>			
					
					
					<input type="hidden" name="proposal/manage_category" value="<x:out select="$xmlData/data/proposal/manage_category" />" />
					<input type="hidden" name="proposal/sub_grant_name" value="<x:out select="$xmlData/data/proposal/sub_grant_name" />" />
					<input type="hidden" name="proposal/grant_name" value="<x:out select="$xmlData/data/proposal/grant_name" />" />
					<input type="hidden" name="proposal/grant_code" value="<x:out select="$xmlData/data/proposal/grant_code" />" />  <input type="hidden" name="proposal/psn_code" value="<x:out select="$xmlData/data/proposal/psn_code" />" />
					<input type="hidden" id="grant_no" name="proposal/grant_no" value="<x:out select="$xmlData/data/proposal/grant_no" />" />							
					<input type="hidden" name="proposal/sub_grant_code" value="<x:out select="$xmlData/data/proposal/sub_grant_code" />" />
					<input name="proposal/register_area_code" type="hidden" value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/area_value" />" />
		            <input name="proposal/register_area_name" type="hidden" value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/area_name" />" />
					<input type="hidden" id="sub_grant_no" name="proposal/sub_grant_no" value="<x:out select="$xmlData/data/proposal/sub_grant_no" />" />
					<input type="hidden" name="proposal/help_grant_code" value="<x:out select="$xmlData/data/proposal/help_grant_code" />" />
					<input type="hidden" id="help_grant_no" name="proposal/help_grant_no" value="<x:out select="$xmlData/data/proposal/help_grant_no" />" />
					<c:set var="formCode"><x:out select="$xmlData/data/proposal/form_code" /></c:set>
					<c:set var="nature_value"><x:out select="$xmlData/data/organizations/organization[@submit_org='1']/nature_value" /> </c:set>
					<c:if test="${empty formCode}"><c:set var="formCode" value="${param.formCode}"></c:set></c:if>
					<input type="hidden" name="proposal/form_code" value="${formCode}" />
				    <input type="hidden" name="proposal/request_amt" 	id="request_amt" value="<x:out select="$xmlData/data/proposal/request_amt"/>">
					<input type="hidden" name="proposal/year" value="${year}" />
					<input type="hidden" name="organizations/organization/nature_value" value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/nature_value" />"/>
					<input type="hidden" name="organization/whether_is_gaoxin_value" value="<x:out select="$xmlData/data/organization/whether_is_gaoxin_value" />"/>
					<input type="hidden" name="organization/whether_industrial_base_value" value="<x:out select="$xmlData/data/organization/whether_industrial_base_value" />"/>
					<input type="hidden" name="organization/whether_is_province_value" value="<x:out select="$xmlData/data/organization/whether_is_province_value" />"/>
					<!-- 申请日期 -->
<%-- 					<input type="hidden" id="submit_date" name="proposal/submit_date" value="<x:out select="$xmlData/data/proposal/submit_date" />" />		
 --%>				 
				 <!-- 公用的配置界面 -->
				    <jsp:include page="./prpeditmain_public.jsp"><jsp:param value="${xmlstr}" name="xmlstr" /></jsp:include>
				</div>
				<div id="tabnav">
					<ul>
						<li class="down" id="tab1" onclick="changeTab(this.id)">
						    <a href="###"><span>单位基本情况</span></a>
						</li>
						
						<li  id="tab2" onclick="changeTab(this.id)">
						    <a href="###"><span>项目基本情况</span></a>
						</li>
						
						 <li id="tab3" onclick="changeTab(this.id)" >
						    <a href="###"><span>经费说明</span></a>
						</li> 
						<li id="tab4" onclick="changeTab(this.id)" >
						    <a href="###"><span>绩效目标</span></a>
						</li>
					
						<li id="tab5" onclick="changeTab(this.id)">
						    <a href="###"><span>项目绩效指标</span></a>
						</li>
						
						<li id="tab6" onclick="changeTab(this.id)" >
						    <a href="###"><span>附件清单</span></a>
						</li>	
					</ul>
				</div>
				<!-- 单位基本情况 -->
				<div class="tab_box" id="fragment-tab1">
					<jsp:include page="../org/prporg_baseinfo_enterprise_2018.jsp">
						<jsp:param value="1、单位基本信息" name="title" />
						<jsp:param value="2、单位人员情况" name="title2" />
						<jsp:param value="3、单位财务状况" name="title3" />
						<jsp:param value="4、企业开展产学研合作情况" name="title4" />
						<jsp:param value="5、主营业务产品" name="title5" />
						<jsp:param value="6、知识产权情况" name="title6" />
					</jsp:include>
				</div>
				<!-- 项目基本情况 --><!-- ../../view/goal/prpgoaledit__gjjhsjkjcxjd_2019.jsp -->
				 <div class="tab_box" id="fragment-tab2" style="display: none">
					<jsp:include page="../goal/prpgoaledit_dfkyjctjhnljs_2019.jsp"></jsp:include>
				</div>
				<!-- 经费说明 -->
				 <div class="tab_box" id="fragment-tab3" style="display: none">
					<jsp:include page="../org/prporg_dfkyjctjhnljs_2019.jsp"></jsp:include>
				</div>
				<!-- 绩效目标-->
				 <%-- <div class="tab_box" id="fragment-tab4" style="display:none">
					<jsp:include page="../org/prporg_dfkyjctjhnljs_jxzb_2019.jsp"></jsp:include>
					<jsp:include page="../org/prporgedit_kjjzfp_2019.jsp"></jsp:include>
				</div> --%>
				
				<!-- 项目绩效目标-->
				<div class="tab_box" id="fragment-tab4" style="display: none">
					<jsp:include page="../org/prporgedit_achievements_comment_2019_02.jsp"></jsp:include>
				</div>
				
				<!--项目绩效指标 -->
				<div class="tab_box" id="fragment-tab5" style="display: none">
					<jsp:include page="../info/prpInfoEdit_kjyqfhq_2019.jsp">
						<jsp:param value="${statYear }" name="statYear"/>
					</jsp:include>
				</div>
				
				<!-- 需提交的材料 -->
				<div class="tab_box" id="fragment-tab6" style="display: none">
					<jsp:include page="../attach/prpAttachEdit_kjhmjh.jsp">
						<jsp:param value="${xmlstr}" name="xmlstr" />
					</jsp:include>
					<p style="font-size: 13px"><strong>备注：</strong></p>
					<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、递交纸质材料时，提供系统打印的申请书纸质文件，连同以上附件材料（一式四份，A4规格，正反面打印，附有目录及页码，胶装成册），签字盖章后报送归口管理部门</p>
					<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、递交纸质材料时，申报单位所在地归口管理部门校验以上附件材料</p>
				</div>
				
			<!-- 公用的配置界面 ：保存、提交等button -->
			<jsp:include page="./prpeditmain_public_last.jsp"><jsp:param value="${xmlstr}" name="xmlstr" /></jsp:include>
		</div>
		<div class="clear_h15"></div>
	</div>
</body>

</html>